<?php


namespace app\admin\controller\base;


use app\admin\service\base\SubjectService;
use app\BaseController;
use think\response\Json;

class Subject  extends BaseController
{
    /**
     * 列表
     * @return Json
     */
    public function index(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->index($params);
    }

    /**
     * 导入题目
     * @param SubjectService $subjectService
     * @return Json
     * @throws \Exception
     */
    public function import(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->import($params);
    }

    /**
     * 详情
     * @param SubjectService $subjectService
     * @return Json
     */
    public function read(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->read($params);
    }

    /**
     * 创建
     * @return Json
     */
    public function save(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->save($params);
    }

    /**
     * 更新
     * @return Json
     */
    public function update(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->update($params);
    }


    /**
     * 删除
     * @return Json
     */
    public function delete(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->delete($params);
    }

    /**
     * 题目启用和禁止
     * @return Json
     */
    public function subjectStatus(SubjectService $subjectService):Json
    {
        $params = request()->param();
        return $subjectService->do_status($params);
    }
}